package com.brp.dao;

import com.brp.po.Removecargo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author all
 * @since 2022-03-16
 */
public interface RemovecargoMapper extends BaseMapper<Removecargo> {
    @Update("truncate table t_removecargo")
    Integer removeRemoveCargoAll();

    @Select("select remove_id, fk_cargo_id, cargo_number, cargo_id, cargo_name, cargo_vender, fk_provider_id, cargo_purchase_price, cargo_sale_price, cargo_type, cargo_repertory from t_removecargo inner join t_cargo tc on t_removecargo.fk_cargo_id = tc.cargo_id")
    @Results(id = "removeCargoMap",value = {
            @Result(column = "remove_id",property = "removeId"),
            @Result(column = "fk_cargo_id",property = "fkCargoId"),
            @Result(column = "cargo_number",property = "cargoNumber"),
            @Result(column = "fk_cargo_id",property = "cargo",
            one = @One(select = "com.brp.CargoMapper.getById",fetchType = FetchType.LAZY))
    })
    List<Removecargo> getAllRemoveCargo();
}
